package com.feilo.biz.impl;

import java.util.List;

import com.feilo.biz.AdminBiz;
import com.feilo.dao.AdminDao;
import com.feilo.dao.impl.AdminDaoImpl;
import com.feilo.entity.Admin;

public class AdminBizImpl implements AdminBiz {
	AdminDao ad=new AdminDaoImpl();
	public void delete(Integer adminid) {
		ad.delete(adminid);

	}

	public Admin getAdmin(Integer adminid) {
		return ad.find(adminid);
	}

	@SuppressWarnings("unchecked")
	public List<Admin> getAdmins() {
		String hql="from Admin order by id desc";
		List<Admin> u= (List<Admin>) ad.findByHQL(hql);
		return  u;
	}

	public void save(Admin admin) {
		ad.save(admin);

	}

	public void update(Admin admin) {
		ad.update(admin);
	}

	@SuppressWarnings("unchecked")
	public List<Admin> getAdminsBySerch(String parm) {
		String hql="from Admin where u_username like'"+"%"+parm+"%"+"'"+"order by id desc";
		List<Admin> u= (List<Admin>) ad.findByHQL(hql);
		return  u;
	}

}
